<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
    *{
        padding: 0;
            margin: 0;
            list-style: none;
            text-decoration: none;
    }
    #app {
    width: 400px;
    border: 1px solid #000;
    margin: 60px auto;
  }
  .tab-bar {
    width: 400px;
    background-color: #87cee8;
    display: flex;
    justify-content: space-between;
  }
  .tab-bar a {
    flex: 1; 
    text-align: center;
    cursor: pointer;
    color: #000;
  }
  .tab-bar .active {
    background-color: #0099ff;
    color: #fff;
  }
  .tab-con div {
    text-align: center;
    height: 200px;
    line-height: 200px ;
  }
    </style>
</head>
<body>
   

    <div id="app">
        <!-- 选项栏 -->
        <div class="tab-bar">
          <a href="javascript:;"
             v-on:click="tab(index)"
             v-for="(item,index) in title"
             :class="{active : index===curId}"
          >{{item.item}}</a>
        </div>
        <!-- 选项卡 -->
        <div class="tab-con">
          <div
            v-show="index===curId"
            v-for="(item, index) in contents" >{{item.item}}</div>
        </div>
      </div>

      <script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script>

      <script>
        
        let vm = new Vue({
            el:'#app',
            data : {
              curId: 0,
              title: [
                {item: 'html'},
                {item: 'css'},
                {item: 'js'},
                {item: 'vuejs'},
              ],
              contents: [
                {item: 'html-contents'},
                {item: 'css-contents'},
                {item: 'js-contents'},
                {item: 'vuejs-contents'},
              ]
            
          },
          methods: {
            tab (index) {
              this.curId = index;
            }
          }
        })
      </script>
</body>
</html>